package org.dna.metronomo.persistence;

import java.util.List;

public interface IUserDAO {

	/**
	 * Return the user identified by username and password, else return null;
	 * 
	 * @param username
	 * @param password
	 * @return the instance of the corresponding user if authenticated, else null
	 * */
	User findUser(String username, String password);

	/**
	 * Insert the user passed in as a new user.
	 * */
	void addNewUser(User user);

	/**
	 * Update all the user datas except username with that given by <code>user</code>
	 * */
	void update(User user);
	
	/**
	 * Return a list of all users defined in metronomo.
	 * */
	List<User> users();
	
	/**
	 * Remove an user using the instance as template
	 * */
	void deleteByExample(User... user) throws PersistenceException;
	
	/**
	 * Removes a list of users identified by the ID.
	 * */
	void deleteByID(int... id) throws PersistenceException;
	
	/**
	 * Return the user by primary key, or null if the key is invalid.
	 * */
	User findByID(int id) throws PersistenceException;

}
